<template>
  <div class="main flex">
    <v-libsnav v-bind:item="currentItem"></v-libsnav>
    <v-workbox v-on:handle="handle"></v-workbox>
    <v-propertybox v-bind:pbox="pbox"></v-propertybox>
  </div>
</template>

<script>
import libsnav from './layout/libsnav'
import workbox from './layout/workbox'
import propertybox from './layout/propertybox'
import Utils from '../utils'

export default {
  name: 'main-body',
  components: {
    'v-libsnav': libsnav,
    'v-workbox': workbox,
    'v-propertybox': propertybox
  },
  data:function(){
    return {
      pbox:{},
      currentItem:{}
    }
  },
  methods:{
    handle:function(item){
      //将模块extend的内容复制到顶级配置
      if(item.component=='v-upatta' || item.component=='v-upimg'){
        item.property.intro = item.property.upfile.extend.intro
      }
      var propertyType = Utils.get_component_property(item.component)
      this.pbox= {component: propertyType,relation: item}
      this.currentItem = item
    }
  }
}
</script>
